﻿using CommandLinex;
using System.Text.Json;

namespace N_m3u8DL_RE.CommandLinex
{
    public class HeaderValueProcessor : ICommandLineValueProcessor
    {
        /// <summary>
        /// 从Json字符串值处理请求头信息将其转换为字典形式。
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <returns></returns>
        public object Process(string value, Type targetType)
        {
            if (string.IsNullOrEmpty(value))
                return null;
            return JsonSerializer.Deserialize(value, targetType);
        }
    }
}
